<!--数字滑块-->
<template>
  <el-slider
    v-model="value"
    v-bind="$attrs"
    :id="'c' + meta.columnId"
    :name="'c' + meta.columnId"
    :clearable="clearable"
  >
  </el-slider>
</template>

<script setup lang="ts" generic="T extends object">
  import type { IFormItemProps } from '../../map'
  import { itemController } from '../../map'

  defineOptions({
    name: 'nf-el-from-item-range',
    inheritAttrs: false,
  })

  const props = withDefaults(defineProps<IFormItemProps<T>>(), {
    meta: () => {
      return {
        colName: ''
      }
    },
    model: () => {
      return {} as T
    },
    clearable: true
  })

  const { value } = itemController(props)
  
  // 设置默认值
  if (props.meta.defValue) {
    value.value = props.meta.defValue
  }

</script>
